package com.yssw.client.service.impl;

import java.util.List;

import com.yssw.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yssw.client.mapper.DrinkWaterLogMapper;
import com.yssw.client.domain.DrinkWaterLog;
import com.yssw.client.service.IDrinkWaterLogService;

/**
 * 用水记录Service业务层处理
 *
 * @author yssw
 * @date 2023-04-03
 */
@Service
public class DrinkWaterLogServiceImpl implements IDrinkWaterLogService {
    @Autowired
    private DrinkWaterLogMapper drinkWaterLogMapper;



    /**
     * 查询用水记录
     *
     * @param id 用水记录主键
     * @return 用水记录
     */
    @Override
    public DrinkWaterLog selectDrinkWaterLogById(Long id) {
        return drinkWaterLogMapper.selectDrinkWaterLogById(id);
    }

    /**
     * 查询用水记录列表
     *
     * @param drinkWaterLog 用水记录
     * @return 用水记录
     */
    @Override
    public List<DrinkWaterLog> selectDrinkWaterLogList(DrinkWaterLog drinkWaterLog) {
        return drinkWaterLogMapper.selectDrinkWaterLogList(drinkWaterLog);
    }

    /**
     * 新增用水记录
     *
     * @param drinkWaterLog 用水记录
     * @return 结果
     */
    @Override
    public int insertDrinkWaterLog(DrinkWaterLog drinkWaterLog) {
        drinkWaterLog.setCreateTime(DateUtils.getNowDate());
        return drinkWaterLogMapper.insertDrinkWaterLog(drinkWaterLog);
    }

    /**
     * 修改用水记录
     *
     * @param drinkWaterLog 用水记录
     * @return 结果
     */
    @Override
    public int updateDrinkWaterLog(DrinkWaterLog drinkWaterLog) {
        drinkWaterLog.setUpdateTime(DateUtils.getNowDate());
        return drinkWaterLogMapper.updateDrinkWaterLog(drinkWaterLog);
    }

    /**
     * 批量删除用水记录
     *
     * @param ids 需要删除的用水记录主键
     * @return 结果
     */
    @Override
    public int deleteDrinkWaterLogByIds(Long[] ids) {
        return drinkWaterLogMapper.deleteDrinkWaterLogByIds(ids);
    }

    /**
     * 删除用水记录信息
     *
     * @param id 用水记录主键
     * @return 结果
     */
    @Override
    public int deleteDrinkWaterLogById(Long id) {
        return drinkWaterLogMapper.deleteDrinkWaterLogById(id);
    }
}
